import { getAreaObj } from '@/utils/util'
const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{ label: '身份证号', prop: 'idCard' },
		{
			label: '从业人员',
			prop: 'practitionersName',
			width: 140,
			render: ({ row }) => {
				let str = [row.practitionersName, row.genderLabel, row.age].filter(Boolean).join(' / ')
				return str
			},
		},
		{ label: '联系方式', prop: 'phone' },
		{ label: '职业类型', prop: 'occupationTypeLabel' },
		{label:'评价分数',prop:''},
		{label:'异常行为',prop:''},
		{ label: '在职状态', prop: 'serviceStateLabel' },
		{
			label: '操作',
			prop: 'menu',
			width: 200,
			fixed: 'right',
		},
	],
}

export const baseConfig = {
	pageName: '从业人员',
	dictcodes: ['ID_CARD_TYPE', 'NATIONALITY', 'POLITICAL_STATUS', 'EDUCATION_DEGREE', 'MARITAL_STATUS', 'MARITAL_STATUS', 'OCCUPATION_TYPE'],
	rowKey: 'id',
	api: {
		index: 'view_dpFoundationPractitioners_page',
	},
	auth: {
		index: 'view_dpFoundationPractitioners_page',
	},
	menuBtn: [
		{
			icon: 'detail',
			label: '查看详情',
			type: 'primary',
			operate: 'Archives',
			auth: 'view_dpFoundationPractitioners_page',
			text: true,
			show: true,
		},
	],
	dialogConfig: {
		width: '80%',
	},
	tableConfig,
	onLoadFormate: async (arr) => {
		const tableData = arr.map((item) => {
			const unitAddress: any = getAreaObj(item, 'unit', 'set')
			return {
				...(item.dpFoundationPractitionersExtendPO || {}),
				...item,
				unitAddress: unitAddress.names,
			}
		})
		return Promise.resolve(Object.freeze(tableData))
	},
}
